![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@material/notched-outline
Advanced tools
The Material Components for the web notched-outline component
@material/notched-outline is a package from Material Design Components (MDC) that provides a notched outline component. This component is typically used to create a visual effect around form fields, such as text fields, to indicate focus or selection. The notched outline is a key part of the Material Design guidelines for text fields.
Basic Notched Outline
This code sample demonstrates the basic structure of a notched outline with a floating label. The HTML structure includes the leading, notch, and trailing elements, while the CSS provides basic styling to visualize the notched outline.
{
"html": "<div class='mdc-notched-outline'><div class='mdc-notched-outline__leading'></div><div class='mdc-notched-outline__notch'><span class='mdc-floating-label'>Label</span></div><div class='mdc-notched-outline__trailing'></div></div>",
"css": ".mdc-notched-outline { position: relative; border: 1px solid; } .mdc-notched-outline__leading, .mdc-notched-outline__trailing { display: inline-block; } .mdc-notched-outline__notch { display: inline-block; padding: 0 8px; } .mdc-floating-label { position: absolute; top: -8px; left: 8px; }"
}
Notched Outline with Focus
This code sample shows a notched outline in a focused state. The `mdc-notched-outline--upgraded` and `mdc-notched-outline--notched` classes are used to apply styles that indicate focus, such as changing the border color to blue and floating the label above the notch.
{
"html": "<div class='mdc-notched-outline mdc-notched-outline--upgraded mdc-notched-outline--notched'><div class='mdc-notched-outline__leading'></div><div class='mdc-notched-outline__notch'><span class='mdc-floating-label mdc-floating-label--float-above'>Label</span></div><div class='mdc-notched-outline__trailing'></div></div>",
"css": ".mdc-notched-outline { position: relative; border: 1px solid; } .mdc-notched-outline--upgraded { border-color: blue; } .mdc-notched-outline--notched .mdc-notched-outline__notch { border-color: blue; } .mdc-floating-label--float-above { color: blue; }"
}
React Material-UI is a popular library that implements Material Design components for React applications. It includes a TextField component with a notched outline feature, similar to @material/notched-outline. However, it is more comprehensive, offering a wide range of Material Design components beyond just the notched outline.
Vuetify is a Material Design component framework for Vue.js. It provides a variety of components, including form inputs with notched outlines. Vuetify is similar to @material/notched-outline in that it adheres to Material Design guidelines, but it is tailored specifically for Vue.js applications.
Angular Material is a UI component library for Angular developers that follows Material Design principles. It includes form field components with notched outlines, similar to @material/notched-outline. Angular Material is designed to integrate seamlessly with Angular applications, providing a consistent look and feel.
The notched outline is a border around all sides of either a Text Field or Select component. This is used for the Outlined variant of either a Text Field or Select.
npm install @material/notched-outline
<span class="mdc-notched-outline">
<span class="mdc-notched-outline__leading"></span>
<span class="mdc-notched-outline__notch">
<span class="mdc-floating-label">Label</span>
</span>
<span class="mdc-notched-outline__trailing"></span>
</span>
Note that the MDC Floating Label component is placed inside the notch element when used together with MDC Notched Outline.
See the MDC Text Field and MDC Select documentation for information on using Notched Outline in the context of those components.
@use "@material/notched-outline/mdc-notched-outline";
import {MDCNotchedOutline} from '@material/notched-outline';
const notchedOutline = new MDCNotchedOutline(document.querySelector('.mdc-notched-outline'));
See Importing the JS component for more information on how to import JavaScript.
CSS Class | Description |
---|---|
mdc-notched-outline | Mandatory. Container for the outline's sides and notch. |
mdc-notched-outline--notched | Modifier class to open the notched outline. |
mdc-notched-outline--no-label | Modifier class to use when the floating label is empty or not used. |
mdc-notched-outline__leading | Mandatory. Element representing the leading side of the notched outline (before the notch). |
mdc-notched-outline__notch | Mandatory. Element representing the notch. |
mdc-notched-outline__trailing | Mandatory. Element representing the trailing side of the notched outline (after the notch). |
Mixin | Description |
---|---|
color($color) | Customizes the border color of the notched outline. |
stroke-width($width) | Changes notched outline width to a specified pixel value. |
shape-radius($radius, $rtl-reflexive) | Sets the rounded shape to notched outline element with given radius size. Set $rtl-reflexive to true to flip radius values in RTL context, defaults to false. |
floating-label-float-position($positionY, $positionX, $scale) | Sets the position and scale of the floating label inside the notched outline. |
MDCNotchedOutline
Properties and MethodsMethod Signature | Description |
---|---|
notch(notchWidth: number) => void | Opens the notch with the specified width. |
closeNotch() => void | Closes the notch, rendering a full outline. |
If you are using a JavaScript framework, such as React or Angular, you can create a Notched Outline for your framework. Depending on your needs, you can use the Simple Approach: Wrapping MDC Web Vanilla Components, or the Advanced Approach: Using Foundations and Adapters. Please follow the instructions here.
MDCNotchedOutlineAdapter
Method Signature | Description |
---|---|
addClass(className: string) => void | Adds a class to the notched outline element. |
removeClass(className: string) => void | Removes a class from the notched outline element. |
setNotchWidthProperty(width: number) => void | Sets the width of the notch in pixels. |
removeNotchWidthProperty() => void | Removes the width property from the notch element. |
MDCNotchedOutlineFoundation
Method Signature | Description |
---|---|
notch(notchWidth: number) => void | Adds the mdc-notched-outline--notched class and updates the notch element's style based on notchWidth . |
closeNotch() => void | Removes the mdc-notched-outline--notched class. |
6.0.0 (2020-04-22)
[@use](https://github.com/use)
(098ae32)indeterminate
checkbox (b273afa)select: HTML Markup significantly changed, see README; REMOVED adapter methods isSelectedTextFocused
, getSelectedTextAttr
, setSelectedTextAttr
; ADDED adapter methods isSelectAnchorFocused
, getSelectAnchorAttr
, setSelectAnchorAttr
; removed variables outlined-dense-label-position-y
, icon-padding
; added variables minimum-height-for-filled-label
, filled-baseline-top
, selected-text-height
, anchor-padding-left
, anchor-padding-left-with-leading-icon
, anchor-padding-right
.
text-field: Redundant mixins mdc-text-field-textarea-fill-color
, mdc-text-field-textarea-stroke-color
, mdc-text-field-fullwidth-bottom-line-color
removed. Instead, use mdc-text-field-fill-color
, mdc-text-field-outline-color
, and mdc-text-field-bottom-line-color
respectively to achieve the same effect.
textfield: mdc-text-field--dense and associated mixins/variables have been removed. Use the density() mixin instead.
textfield: removed the following variables: $input-padding
, $input-padding-top
, $input-padding-bottom
, $outlined-input-padding-top
, $outlined-input-padding-bottom
, $input-border-bottom
linear-progress: DOM for linear progress buffer changed. MDCLinearProgressAdapter method getBuffer
, getPrimaryBar
, setStyle
removed. MDCLinearProgressAdapter method setBufferBarStyle
, setPrimaryBarStyle
added.
linear-progress: DOM for linear progress buffer changed. MDCLinearProgressAdapter method getBuffer
, getPrimaryBar
, setStyle
removed. MDCLinearProgressAdapter method setBufferBarStyle
, setPrimaryBarStyle
added.
typography: typography.baseline-top()
and typography.baseline-bottom()
are now private. Use typography.baseline()
for containers and typography.text-baseline()
for text with $top and $bottom params.
chips: The touch target and text now appear inside the primary action element. Please see the readme for markup changes.
textfield: filled text fields must include a <div class="mdc-text-field__ripple"></div>
textfield: Filled textfields will no longer show a floating label at certain densities. This can be overridden by setting $mdc-text-field-minimum-height-for-filled-label: 40px
chips: Both MDCChipAdapter
and MDCChipSetAdapter
have new methods. MDCChipSetFoundation
event handlers now accept the corresponding chip event detail interface as the sole argument. The root
property has been removed from the MDCChipRemovalEventDetail
interface.
line-ripple: mdc-line-ripple-color()
mixin has been renamed to mdc-line-ripple-active-color()
textfield: Default textfields must now specify mdc-text-field--filled. Disabled outlined textfields no longer have a shaded background. Height mixin no longer specifies a baseline override, use typography's baseline-top mixin.
Four variables and a mixin in mdc-textfield were renamed to use a mdc-text-field- prefix when depended on via @import (formerly mdc-required-text-field-label-asterisk_, now required-label-asterisk_).
textfield: icons must use .mdc-text-field__icon--leading
or .mdc-text-field__icon--trailing
classes. mdc-text-field-icon-color()
mixin has been split into mdc-text-field-leading-icon-color()
and mdc-text-field-trailing-icon-color()
.
switch: Added setNativeControlAttr method in mdc-switch adapter.
checkbox: remove event listener for 'change' and add event listener for 'click'.
$mdc-button-disabled-container-fill-color
renamed to $mdc-button-disabled-container-color
.$edgeOptOut
option from mdc-theme-prop()
Sass mixin.FAQs
The Material Components for the web notched-outline component
The npm package @material/notched-outline receives a total of 0 weekly downloads. As such, @material/notched-outline popularity was classified as not popular.
We found that @material/notched-outline demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 15 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.